/**
 * Created by lyc on 2017/3/28.
 */
'use strict'
import * as types from '../mutations-type'
import axios from 'axios'
import api from '../api'
const state = {
  log_tableData: [],
  checkNum: 0
}

const mutations = {
  [types.LOG_REQ_LIST] (state, action) {
    state.log_tableData = action.result.data
  },
  [types.LOG_CHECK_NUM] (state, action) {
    state.checkNum = action.num
  }
}
const getters = {
  log_tableData: state => state.log_tableData
}
const actions = {
  [types.LOG_REQ_LIST] ({commit}, params) {
    axios.get(api.balanceLogList + params)
      .then(response => {
        commit(types.LOG_CHECK_NUM, {
          num: 0
        })
        commit(types.LOG_REQ_LIST, {
          result: response
        })
      })
  },
  [types.LOG_CHECK_NUM] ({commit}, num) {
    commit(types.LOG_CHECK_NUM, {
      num: num
    })
  }
}

export default {
  getters,
  state,
  actions,
  mutations
}
